import Utils from "@/utils/utils.js"
//立即下单，购物车下单
export function placeOrder(params) {
	return new Promise((resolve, reject) => {
		Utils.baseRequest({
			url: "scc/ordermanage/addOrder",
			method: "POST",
			data: params,
		}).then(res => {
			resolve(res.data)
		}, err => {
			reject(err)
		})
	})
}
//支付订单
export function payOrder(orderNums, amount) {
	return new Promise((resolve, reject) => {
		Utils.baseRequest({
			url: `scc/ordermanage/payOrder?orderNums=${orderNums}&amount=${amount}`,
			method: "POST",
		}).then(res => {
			resolve(res.data)
		}, err => {
			reject(err)
		})
	})
}
//查询我的订单
export function getMyOrderList(pageNum, pageSize, tMemberid, tOrderstatus) {
	return new Promise((resolve, reject) => {
		Utils.baseRequest({
			url: `scc/ordermanage/getMyOrderList?pageNum=${pageNum}&pageSize=${pageSize}&tMemberid=${tMemberid}&tOrderstatus=${tOrderstatus}`
		}).then(res => {
			resolve(res.data)
		}, err => {
			reject(err)
		})
	})
}

//确认收货
export function confirmOrder(orderNum) {
	return new Promise((resolve, reject) => {
		Utils.baseRequest({
			url: `scc/ordermanage/confirmOrder/${orderNum}`,
			method: "POST",
		}).then(res => {
			resolve(res.data)
		}, err => {
			reject(err)
		})
	})
}
